<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
$(function(){
	$("#folderDialog").dialog({
	    title: '收藏夹维护',
	    width: 800,
	    top:100,
	    closed: true,
	    cache: false,
	    modal: true
	});
	
	$("#addButton").click(function(){
		$("#folderDialog").dialog('refresh',
				'<c:url value="/docFolder/docFolderEdit" />?folderType=<c:out value="${docFolder.folderType}" />&parentId=<c:out value="${docFolder.folderId}" />&parentName='+encodeURIComponent(encodeURIComponent('<c:out value="${docFolder.folderName}" />')))
				.dialog('open');
	});
	$("#editButton").click(function(){
		$("#folderDialog").dialog("open").dialog('refresh',
				'<c:url value="/docFolder/docFolderEdit" />?folderId=<c:out value="${docFolder.folderId}" />')
				;
	});
	$("#delButton").click(function(){
		$.ajax({
			   type: "POST",
			   url: "<c:url value='/docFolder/docFolderDel' />",
			   data: "folderId=<c:out value='${docFolder.folderId}' />",
			   async: false,
			   success: function(msg){
			     if(msg.state=="200"){
			    	 treeSelectedId="<c:out value='${docFolder.parentId}' />";
			    	 $("#folderTree").tree("reload");
			     }else if(msg.state=="500"){
			    	 $.messager.alert('提示','数据删除失败');
			     }else{
			    	 $.messager.alert('提示','该文件夹有关联数据，无法删除');
			     }
			   }
			});
	});
});